/*
 Copyright (C) 2010-2013. 
 Ezequiel Palumbo, Calipsoide FOSS Foundation.
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU Lesser General Public License as published by
 the Free Software Foundation, either version 3 of the License, or
 (at your option) any later version.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU Lesser General Public License for more details.

 You should have received a copy of the GNU Lesser General Public License
 along with this program.  If not, see http://www.gnu.org/licenses/. 
 
 Email: contacto@ehpalumbo.com.ar 
*/

package org.calipsoide.dbf2xml;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import org.calipsoide.dbf2xml.model.Field;

/**
 * 
 * Represents the required configuration for processing a DBF, extract data
 * from it and convert results into a XML document. Setter methods returns 
 * self object, in order to allow chaining and simplify configuration. 
 * 
 * @since 1.0
 * @author ehpalumbo
 *
 */
public class TableProcessingConfiguration {

	private String code;
	private String path;
	private List<String> projections;
	private Set<Field> restrictions;
	private Integer since;
	private Integer maximum;
	private String encoding;
	private Integer indent;

	/**
	 * 
	 * Creates configuration with an identifier code and the path of the DBF.
	 * 
	 * @param code ID of the data source
	 * @param path of the DBF in file system
	 * 
	 */
	public TableProcessingConfiguration(String code, String path) {
		super();
		this.code = code;
		this.path = path;
		this.projections = new ArrayList<String>();
		this.restrictions = new HashSet<Field>();
	}

	public String getCode() {
		return code;
	}

	public String getPath() {
		return path;
	}

	public TableProcessingConfiguration setPath(String path) {
		this.path = path;
		return this;
	}

	public List<String> getProjections() {
		return projections;
	}

	public TableProcessingConfiguration setProjections(
			List<String> projections) {
		this.projections = projections;
		return this;
	}

	public Set<Field> getRestrictions() {
		return restrictions;
	}

	public TableProcessingConfiguration setRestrictions(
			Set<Field> restrictions) {
		this.restrictions = restrictions;
		return this;
	}

	public Integer getSince() {
		return since;
	}

	public TableProcessingConfiguration setSince(Integer since) {
		this.since = since;
		return this;
	}

	public Integer getMaximum() {
		return maximum;
	}

	public TableProcessingConfiguration setMaximum(Integer maximum) {
		this.maximum = maximum;
		return this;
	}

	public String getEncoding() {
		return encoding;
	}

	public TableProcessingConfiguration setEncoding(String encoding) {
		this.encoding = encoding;
		return this;
	}

	public Integer getIndent() {
		return indent;
	}

	public TableProcessingConfiguration setIndent(Integer indent) {
		this.indent = indent;
		return this;
	}

	@Override
	public String toString() {
		return "TableProcessingConfiguration [code=" + code + ", path=" + path
				+ ", projections=" + projections + ", restrictions="
				+ restrictions + ", since=" + since + ", maximum=" + maximum
				+ ", encoding=" + encoding + ", indent=" + indent + "]";
	}
	
}
